package com.briup.cms.web.controller;

import com.briup.cms.bean.Privilege;
import com.briup.cms.bean.Role_Privilege;
import com.briup.cms.service.IRole_PrivilegeService;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cms_role_privilege")
public class Role_PrivilegeController {

    @Autowired
    private IRole_PrivilegeService role_privilegeService;
    @GetMapping("findAll")
    public Message findAll(){
        List<Role_Privilege> list=role_privilegeService.findAll();
        return MessageUtil.success(list);
    }
    @GetMapping("saveOrUpdate")
    public Message saveOrUpdate(Role_Privilege role_privilege){
        role_privilegeService.saveOrUpdate(role_privilege);
        return MessageUtil.success(role_privilege);
    }


    @GetMapping("deleteById")
    public Message deleteById(long id){
        role_privilegeService.deleteById(id);
        return MessageUtil.success(id);
    }

}
